home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
D.I.S.C. 1
/
D.I.S.C. 1.adf
/
sources
/
stars.s
Wrap
Text File
|
2022-11-05
|
3KB
|
159 lines
*************************
** 3D Stars in Sprites **
** ©'89 MMS of Level 4 **
*************************
jmp $30000
org $30000 ; Startadresse $30000
load $30000
Field= $40000 ; Zwischenspeicher
Spr1= Field+244 ; Sprite 1
Spr2= Spr1+1608 ; Sprite 2
Stars= Spr2+1608 ; Koordinaten
Anz=40
o: move.l #Start,$80.w
trap #0 ; Prg runs in TRAP#0
rts
Start: move.w #$2700,sr ; IRQ out / Supervisor
move.w #$8400,$96(a5)
clr.l 0 ; Other sprites off !
lea.l $dff000,a5
bsr.L Init_Stars ; Initizate Routine
move.l #Copper,$80(a5)
Sync: cmp.b #$f1,$6(a5) ; Auf Rasterzeile $f1 warten
bne.s sync
move.w #$0fff,$180(a5) ; Col00 = weiss
bsr.L Write_Stars ; Calculate Pos. + Write in Sprites
bsr.L Move_Stars ; Move Stars
move.w #$0000,$180(a5) ; Col00 = schwarz
and.b #$40,$bfe001 ; Mouse button ?
bne.s Sync
lea.l GfxName,a1 ; Open GFX library
move.l 4.w,a6
jsr -408(a6)
move.l d0,a1
move.l $26(a1),$80(a5) ; old Copper
jsr -414(a6) ; Close GFX library
rte
GfxName:dc.b "graphics.library",0
even
Copper: dc.w $0180,$0000,$0182,$0000
dc.w $008e,$2900,$0090,$f1ff,$0092,$0038,$0094,$00d0
dc.w $0100,$1200,$00e0,$0000,$00e2,$0000
dc.w $0120,spr1/$10000,$0122,spr1 ; Sprite0
dc.w $0124,spr2/$10000,$0126,spr2 ; Sprite1
dc.w $01a2,$0fff,$01a4,$0888,$01a6,$0333 ; SprCol0+1
dc.w $0128,$0000,$012a,$0000,$012c,$0000,$012e,$0000
dc.w $0130,$0000,$0132,$0000,$0134,$0000,$0136,$0000
dc.w $0138,$0000,$013a,$0000,$013c,$0000,$013e,$0000
dc.w $ffff,$fffe
Rnd: move.w $6(a5),d0
muls Zufall,d0
move.w d0,Zufall
add.w #$4123,Zufall
rts
Zufall: dc.w $1234,$0
Init_Stars:
lea.l Stars,a0
move.w #Anz,d7
StarField:
moveq #0,d0
bsr.s Rnd
move.b d0,(a0)+ ;Set x
bsr.s Rnd
move.b d0,(a0)+ ;Set y
Try_z: bsr.s Rnd
cmp.b #4,d0
bmi.s Try_z
move.b d0,(a0)+ ;Set z
dbf d7,StarField
rts
Write_Stars:
move.w #$0100,$40(a5) ; Clear Field
move.l #Field+$28,$54(a5)
move.w #0,$66(a5)
move.w #[101*64]+1,$58(a5)
lea.l Field,a0
lea.l Stars,a2
move.w #Anz,d7
Writie: move.b (a2)+,d0 ;x->d0
move.b (a2)+,d1 ;y->d1
move.b (a2)+,d2 ;z->d2
lsr.w #2,d2
ext.w d0
ext.w d1
ext.l d0
ext.l d1
divs d2,d0 ;x/z
divs d2,d1 ;y/z
add.b #144,d0 ; x mitte
add.b #141,d1 ; y mitte
and.w #$ff,d1
move.b d0,(a0,d1.w) ; Write in Field
dbf d7,Writie
lea.l Spr1,a0 ; Write in Sprite0+1
lea.l Spr2,a1
lea.l Field,a2
move.w #$29,d1
move.w #99,d7 ; 200 Zeilen !
Writy: move.b (a2,d1.w),d0
beq.s NextSpr
move.b d1,(a0)+
move.b d0,(a0)+
addq.b #1,d1
move.b d1,(a0)+
move.b #0,(a0)+
move.l #$a800d800,(a0)+; Shit pattern (proves Sprites!)
subq.b #1,d1
NextSpr:addq.b #1,d1
move.b (a2,d1.w),d0
beq.s EndSpr
move.b d1,(a1)+
move.b d0,(a1)+
addq.b #1,d1
move.b d1,(a1)+
move.b #0,(a1)+
move.l #$a800d800,(a1)+
subq.b #1,d1
EndSpr: addq.b #1,d1
dbf d7,Writy
move.l #0,(a0) ; Sprites over
move.l #0,(a1)
rts
Move_Stars:
lea.l Stars,a0
move.w #Anz,d7
Movete: sub.b #1,2(a0) ; Move'em
cmp.b #4,2(a0)
bge.s NochNix
move.b #$80,2(a0) ; z=128
bsr.L Rnd
move.b d0,(a0) ; x=rnd
bsr.L Rnd
move.b d0,1(a0) ; y=rnd
NochNix:lea 3(a0),a0
dbf d7,Movete
rts